module page {
    export class AuthPage extends eui.Component{
        private btn_sign_cancel;
        private btn_reward;
        private sign_in_note;
        private sign_box;
        private seven_times;
        private page_mask;
        private authButton;
        private auth_cancel;
        public static readonly AUTH_COMPLETE: string = "auth_complete";

        public constructor() {
            super();
            //let w = manager.DisplayManager.STAGE_WIDTH;
            this.addEventListener(eui.UIEvent.COMPLETE, this.onComplete, this);
            this.skinName = "resource/assets/GameRes/game/v2/skins/AuthSkin.exml";

        }

        protected createChildren() {
            super.createChildren();
            let h = 750 * manager.SystemManager.info.screenHeight / manager.SystemManager.info.screenWidth;
            this.page_mask.width = 750;
            this.page_mask.height = h;
            let screenWidth = manager.SystemManager.info.screenWidth;
            let screenHeight = manager.SystemManager.info.screenHeight;
            this.authButton = wx.createUserInfoButton({
                type: 'text',
                text: '',
                style: {
                    left: 0,
                    top: 200,
                    width: screenWidth,
                    height: screenHeight - 200,
                    lineHeight: 36,
                    backgroundColor: '#00ff0000',
                    color: '#ffffff',
                    textAlign: 'center',
                    fontSize: 16,
                    borderRadius: 4
                }
            });

            this.authButton.show();
            this.authButton.onTap(function (res) {
                if (res["encryptedData"] && res["iv"]) {
                    manager.GameManager.getInstance().getUserManager().onAuthButtonTap(res, true);
                }
            });
            this.auth_cancel.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onSkip, this);
        }

        private onComplete() {}

        private onSkip(eve: egret.Event): void {
            this.authButton.hide();
            this.visible = false;
        }

        public show(): void {
            this.visible = true;
            this.authButton.show();
            //Main.getInstance().getGameManager().getAdManager().onClickStats("signReward", false);
        }

        public hide(eve: egret.Event): void {
            this.authButton.hide();
            this.visible = false;
        }

    }

}